package cn.wolfcode.p2p.base.domain;

import lombok.Getter;
import lombok.Setter;

import java.util.Date;

/**
 * 用户登录日志
 */
@Getter
@Setter
public class IpLog extends BaseDomain {
    //登陆成功的状态
    public static final int STATUS_SUCCESS = 0;
    //登陆失败的状态
    public static final int STATUS_FAILURE = 1;

    //用户类型
    public static final int USERTYPE_WEBSITE = 0; //前台
    public static final int USERTYPE_MGRSITE = 1; //后台

    //用户名
    private String username;
    //时间
    private Date loginTime;
    //地点
    private String ip;
    //状态
    private Integer state;
    //用户类型
    private Integer userType = LoginInfo.USERTYPE_WEBSITE;

    //状态显示名字
    public String getStateName() {
        return state == STATUS_SUCCESS ? "成功" : "失败";
    }

    //用户类型名字
    public String getUserTypeName() {
        return userType == LoginInfo.USERTYPE_WEBSITE ? "前台用户" : "后台用户";
    }

}
